﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace QQ
{
    public partial class DengluHou : Form
    {
        List<Haoyou> li = User.getUser().getList();
        public DengluHou()
        {
            InitializeComponent();
        }
        public string name = null;
        public string user = null;
        private void Form2_Load(object sender, EventArgs e)
        {
            //传值ffss
            label2.Text = name;
            label3.Text = user;
            for (int i = 0; i < 50; i++)
            {
                User.getUser().AddUser("123456" + i, "123456" + i, "小弟" + (i+1) + "号");
            }
            dataGridView1.DataSource = User.getUser().getList();

        }
        private void button1_Click(object sender, EventArgs e)
        {

            List<Haoyou> list = new List<Haoyou>();
            foreach (var item in li)
            {
                if (item.name.IndexOf(textBox1.Text)>=0) 
                {
                    list.Add(item);
                }
            }
            dataGridView1.DataSource = list;
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            LiaoTian fro = new LiaoTian();
            Haoyou hao = new Haoyou();
            hao.name = dataGridView1.SelectedRows[0].Cells["Column1"].Value.ToString();
            hao.yong = dataGridView1.SelectedRows[0].Cells["Column2"].Value.ToString();
            fro.hao = hao;
            fro.Show();
        }
    }
}
